/*     */ package com.umeng.common.util;
/*     */ 
/*     */ import android.content.Context;
/*     */ import android.content.Intent;
/*     */ import android.content.pm.PackageManager;
/*     */ import android.net.Uri;
/*     */ import com.umeng.common.Log;
/*     */ import java.io.File;
/*     */ import java.io.FileInputStream;
/*     */ import java.math.BigInteger;
/*     */ import java.security.MessageDigest;
/*     */ import java.security.NoSuchAlgorithmException;
/*     */ import java.text.DateFormat;
/*     */ import java.text.DecimalFormat;
/*     */ import java.text.SimpleDateFormat;
/*     */ import java.util.Date;
/*     */ import java.util.Locale;
/*     */ 
/*     */ public class h
/*     */ {
/*  32 */   public static final String a = System.getProperty("line.separator");
/*     */   private static final String b = "helper";
/*     */ 
/*     */   public static String a(String paramString)
/*     */   {
/*  42 */     if (paramString == null)
/*  43 */       return null;
/*     */     try {
/*  45 */       byte[] arrayOfByte1 = paramString.getBytes();
/*  46 */       MessageDigest localMessageDigest = MessageDigest.getInstance("MD5");
/*  47 */       localMessageDigest.reset();
/*  48 */       localMessageDigest.update(arrayOfByte1);
/*  49 */       byte[] arrayOfByte2 = localMessageDigest.digest();
/*  50 */       StringBuffer localStringBuffer = new StringBuffer();
/*  51 */       for (int i = 0; i < arrayOfByte2.length; i++) {
/*  52 */         localStringBuffer.append(String.format("%02X", new Object[] { Byte.valueOf(arrayOfByte2[i]) }));
/*     */       }
/*     */ 
/*  55 */       return localStringBuffer.toString();
/*     */     } catch (Exception localException) {
/*     */     }
/*  58 */     return paramString.replaceAll("[^[a-z][A-Z][0-9][.][_]]", "");
/*     */   }
/*     */ 
/*     */   public static String b(String paramString)
/*     */   {
/*     */     try
/*     */     {
/*  72 */       MessageDigest localMessageDigest = 
/*  73 */         MessageDigest.getInstance("MD5");
/*  74 */       localMessageDigest.update(paramString.getBytes());
/*  75 */       byte[] arrayOfByte = localMessageDigest.digest();
/*     */ 
/*  78 */       StringBuffer localStringBuffer = new StringBuffer();
/*  79 */       for (int i = 0; i < arrayOfByte.length; i++) {
/*  80 */         int j = 0xFF & arrayOfByte[i];
/*  81 */         localStringBuffer.append(Integer.toHexString(j));
/*     */       }
/*  83 */       return localStringBuffer.toString();
/*     */     }
/*     */     catch (NoSuchAlgorithmException localNoSuchAlgorithmException) {
/*  86 */       Log.a("helper", "getMD5 error", localNoSuchAlgorithmException);
/*     */     }
/*  88 */     return "";
/*     */   }
/*     */ 
/*     */   public static String a(File paramFile)
/*     */   {
/*  98 */     MessageDigest localMessageDigest = null;
/*  99 */     FileInputStream localFileInputStream = null;
/* 100 */     byte[] arrayOfByte = new byte[1024];
/*     */     try
/*     */     {
/* 103 */       if (!paramFile.isFile()) {
/* 104 */         return "";
/*     */       }
/* 106 */       localMessageDigest = MessageDigest.getInstance("MD5");
/* 107 */       localFileInputStream = new FileInputStream(paramFile);
/*     */       int i;
/* 108 */       while ((i = localFileInputStream.read(arrayOfByte, 0, 1024)) != -1) {
/* 109 */         localMessageDigest.update(arrayOfByte, 0, i);
/*     */       }
/* 111 */       localFileInputStream.close();
/*     */     } catch (Exception localException) {
/* 113 */       localException.printStackTrace();
/* 114 */       return null;
/*     */     }
/* 116 */     BigInteger localBigInteger = new BigInteger(1, localMessageDigest.digest());
/* 117 */     return String.format("%1$032x", new Object[] { localBigInteger });
/*     */   }
/*     */ 
/*     */   public static String a(Context paramContext, long paramLong)
/*     */   {
/* 139 */     String str = "";
/* 140 */     if (paramLong < 1000L) {
/* 141 */       str = (int)paramLong + "B";
/* 142 */     } else if (paramLong < 1000000L) {
/* 143 */       str = Math.round((float)paramLong / 1000.0D) + "K";
/*     */     }
/*     */     else
/*     */     {
/*     */       DecimalFormat localDecimalFormat;
/* 144 */       if (paramLong < 1000000000L) {
/* 145 */         localDecimalFormat = new DecimalFormat("#0.0");
/* 146 */         str = localDecimalFormat.format((float)paramLong / 1000000.0D) + "M";
/*     */       } else {
/* 148 */         localDecimalFormat = new DecimalFormat("#0.00");
/* 149 */         str = localDecimalFormat.format((float)paramLong / 1000000000.0D) + "G";
/*     */       }
/*     */     }
/* 151 */     return str;
/*     */   }
/*     */ 
/*     */   public static String c(String paramString) {
/* 155 */     String str = "";
/* 156 */     long l = 0L;
/*     */     try {
/* 158 */       l = Long.valueOf(paramString).longValue();
/*     */     } catch (NumberFormatException localNumberFormatException) {
/* 160 */       return paramString;
/*     */     }
/* 162 */     if (l < 1024L) {
/* 163 */       str = (int)l + "B";
/*     */     }
/*     */     else
/*     */     {
/*     */       DecimalFormat localDecimalFormat;
/* 164 */       if (l < 1048576L) {
/* 165 */         localDecimalFormat = new DecimalFormat("#0.00");
/* 166 */         str = localDecimalFormat.format((float)l / 1024.0D) + "K";
/* 167 */       } else if (l < 1073741824L) {
/* 168 */         localDecimalFormat = new DecimalFormat("#0.00");
/* 169 */         str = localDecimalFormat.format((float)l / 1048576.0D) + "M";
/*     */       } else {
/* 171 */         localDecimalFormat = new DecimalFormat("#0.00");
/* 172 */         str = localDecimalFormat.format((float)l / 1073741824.0D) + "G";
/*     */       }
/*     */     }
/* 174 */     return str;
/*     */   }
/*     */ 
/*     */   public static void a(Context paramContext, String paramString)
/*     */   {
/* 185 */     PackageManager localPackageManager = paramContext.getPackageManager();
/* 186 */     Intent localIntent = localPackageManager.getLaunchIntentForPackage(paramString);
/* 187 */     paramContext.startActivity(localIntent);
/*     */   }
/*     */ 
/*     */   public static boolean b(Context paramContext, String paramString)
/*     */   {
/*     */     try
/*     */     {
/* 200 */       Intent localIntent = new Intent("android.intent.action.VIEW", Uri.parse(paramString));
/* 201 */       paramContext.startActivity(localIntent);
/*     */     } catch (Exception localException) {
/* 203 */       localException.printStackTrace();
/* 204 */       return false;
/*     */     }
/* 206 */     return true;
/*     */   }
/*     */ 
/*     */   public static boolean d(String paramString)
/*     */   {
/* 217 */     return (paramString == null) || (paramString.length() == 0);
/*     */   }
/*     */ 
/*     */   public static boolean e(String paramString)
/*     */   {
/* 230 */     if (d(paramString)) {
/* 231 */       return false;
/*     */     }
/* 233 */     String str = paramString.trim().toLowerCase();
/* 234 */     return (str.startsWith("http://")) || 
/* 235 */       (str.startsWith("https://"));
/*     */   }
/*     */ 
/*     */   public static String a()
/*     */   {
/* 245 */     Date localDate = new Date();
/* 246 */     return a(localDate);
/*     */   }
/*     */ 
/*     */   public static String a(Date paramDate)
/*     */   {
/* 255 */     if (paramDate == null)
/* 256 */       return "";
/* 257 */     SimpleDateFormat localSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);
/* 258 */     return localSimpleDateFormat.format(paramDate);
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\umeng_sdk.jar
 * Qualified Name:     com.umeng.common.util.h
 * JD-Core Version:    0.6.2
 */